<?php

require_once '../funciones.php';
$con        = con_caweb();

$id = $_REQUEST['id'];


$SQL = "SELECT cab.fechafactura,cab.factura,cab.total,cab.iva,cab.base,det.rteFuente,det.rteIva,det.rteIca,det.otros,det.cuadre,cab.valorpagado FROM detallesabonosId det
    inner join cabeceras_fac cab on cab.facturasistema = det.facturasistema WHERE det.idabonos=".$id." ORDER BY cab.facturasistema";

$result = mysql_query( $SQL ) or die("Error Grilla 2.".mysql_error().$SQL);

if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) {
		  header("Content-type: application/xhtml+xml;charset=utf-8"); 
} else {
		  header("Content-type: text/xml;charset=utf-8");
}
echo "<?xml version='1.0' encoding='utf-8'?>";

echo "<rows>";
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
	echo "<row>";			
	echo "<cell>". $row[factura]."</cell>";
        echo "<cell>". $row[fechafactura]."</cell>";
	echo "<cell>". $row[base]."</cell>";
	echo "<cell>". $row[iva]."</cell>";
	echo "<cell>". $row[total]."</cell>";
        echo "<cell>". $row[valorpagado]."</cell>";
	echo "<cell>". $row[rteFuente]."</cell>";
	echo "<cell>". $row[rteIva]."</cell>";
	echo "<cell>". $row[rteIca]."</cell>";
	echo "<cell>". $row[otros]."</cell>";
	echo "<cell>". $row[cuadre]."</cell>";
	echo "</row>";
}
echo "</rows>";				

?>